/*NOTICE

This software was produced for the U. S. Government
under Contract No. FA8721-09-C-0002, and is
subject to the Rights in Noncommercial Computer Software
and Noncommercial Computer Software Documentation Clause
(DFARS) 252.227-7014 (JUN 1995)

(c) 2009 The MITRE Corporation. All Rights Reserved.
*/
package org.mitre.xmltransform.transform;

import java.io.File;

public abstract class Transform {
	public static final int SETARGS_NO_ERROR = 0;
	public static final int SETARGS_BAD_ARGUMENT_COUNT = 1;
	public static final int SETARGS_BASE_TRANSFORM_SPECIFIC_CODE = 100;
	
	public abstract void initialize(File pInputFile, File pOutputFile);
	public int setArguments(String[] pTransformArguments) {
		// assume no transform-specific arguments
		// override this method in transforms that support arguments
		if (pTransformArguments == null || pTransformArguments.length == 0) return SETARGS_NO_ERROR;
		return SETARGS_BAD_ARGUMENT_COUNT;
	}
	public abstract void transform();
	
	public String getUsageMessage() {
		String transformName = this.getClass().getSimpleName();
		transformName = transformName.substring(0, transformName.length() - "Transform".length());
		return "Usage: XmlTransformer < input file > " + transformName  + " < output file >";
	}
	public String getSetArgumentErrorMessage() {
		return "No error message available";
	}
}
